package cn.hm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置springmvc 相关
 *
 * @author Mxb
 * @version 1.0
 * @date 2020/7/16 14:31
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 默认URL根路径 跳转到/login，此url为 spring security提供
     *
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //默认登录页
        // 首页/  自动跳转到 登录页 /login
        registry.addViewController("/").setViewName("redirect:/login");

        // 自定义登录页面
        //registry.addViewController("/").setViewName("redirect:/login-view");
        //registry.addViewController("/login-view").setViewName("view");
    }
}
